<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
    
      // Load the Visualization API and the bar chart package.
      google.load("visualization", "1", {packages:['table']});
      
      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(initializeData);

      // Once visualization API is loaded, retrieve data and set callbacks to run once retrieved.
      function initializeData() {
        // Get Ilima Dorm Data
        var ilimaURL = 'http://spreadsheets.google.com/tq?key=0Av0U6TKHfzXYdG1vUnduR0RVTktyR1ZtNjAtSE9Qbmc&range=A3:D8&gid=0';
        var ilimaQuery = new google.visualization.Query(ilimaURL);
        ilimaQuery.setRefreshInterval(5);
 
        // Set a callback to run when the Ilima floor-level data has been retrieved.
        ilimaQuery.send(displayIlimaEnergyData);

      }

      
      // Callback that gets the Ilima DataTable and displays it.
      function displayIlimaEnergyData(response) {
        // Process errors, if any.
        if (response.isError()) {
            alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
            return;
        }
        
        // Get the data table, and sort it by energy value.
        var data = response.getDataTable();
        var table = new google.visualization.Table(document.getElementById('ilima_chart_div'));
        table.draw(data, {width: '500'});
   }


    </script>
  </head>

  <body>
    <!--Div that will hold the visualization-->
    <div id="ilima_chart_div"><img src="http://www.google.com/ig/images/spinner.gif"/></div>
  </body>
</html>

